#ifndef DRAWKEY_H
#define DRAWKEY_H

#define KEY_LINE1_COUNT  (14) 
#define KEY_LINE2_COUNT  (14)
#define KEY_LINE3_COUNT  (13)
#define KEY_LINE4_COUNT  (12)
#define KEY_LINE5_COUNT  (5)
#define KEY_LINES (5)
#define KEY_COUNT (14 + 14 + 13 + 12 + 5)
#define KEY_CODE_SPACE (KEY_COUNT - 1 - 2)
#define KEY_WIDTH (24)
#define KEY_HEIGHT (24)
#define KEY_COLOR (rgb2col(100,0,0))
#define KEY_SELECT_COLOR (rgb2col(0,0,100))
#define KEY_PRESS_COLOR (rgb2col(0,100,100))
#define KEY_NAME_COLOR rgb2col(100,0,0)

#define KEY_CTRL_BACKSP 8
#define KEY_CTRL_TAB 9
#define KEY_CTRL_CAPS 10
#define KEY_CTRL_ENTER 13
#define KEY_CTRL_SHIFT 14
#define KEY_CTRL_CTRL 5
#define KEY_CTRL_ALT 4

#define KEY_CTRL_COUNT 7

#define KEY_MOVE_UP 1000
#define KEY_MOVE_DOWN 1001
#define KEY_MOVE_LEFT 1002
#define KEY_MOVE_RIGHT 1003 

#define LEFT_SIDE 0
#define RIGHT_SIDE 1

int keycurrentpos[2];
int keycurrentlines[2];
const unsigned char keymap[KEY_COUNT];
const unsigned char keymapCaps[KEY_COUNT];

void initKeyNote();
void DrawKey(int x, int y, int key, int width, int height, int color);
void DrawKeyBoard(int x, int y);
int IsLineEnd(int pos, int side);
int IsCtrlKey(int key);
int KeyWidth(int pos);
int MoveKey(int direction, int side);
int RealKeyCode(int keyline, int keypos);

#endif